<template>
	<view>
		<view class="u-page">
			<view>
				<page-nav :title="xasaGlob.appName" :subtitle="xasaGlob.appAlias"></page-nav>
				
				<up-search placeholder="搜索关键词" margin="0 0 20px 0"
					:disabled="true" @click="toSearch"></up-search>
			</view>
			
			<view class="m-t-20">
				<uni-list>
					<uni-list-item v-for="(item1, index1) in categories" 
					clickable showArrow :thumb="item1.icon" thumb-size="sm"
						:title="item1.text"
						:to="`./list?c=${item1._id}&t=${item1.text}`"
						
						 :key="index1">
					</uni-list-item>
				</uni-list>

				<!-- <up-cell-group title-bg-color="rgb(243, 244, 246)" 
				title="请选择违法行为类别">
					<up-cell :titleStyle="{fontWeight: 500}"
					 :title="item1.text" v-for="(item1, index1) in categories"
						:icon="item1.icon" :key="index1" isLink 
						:url="'/pages/behavior/list?c='+item1._id+'&t='+item1.name" :name="item1.value">
					</up-cell>
				</up-cell-group> -->
			</view>
			<!-- <u-gap height="70"></u-gap> -->
			<!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
		</view>
		<xasa-foot></xasa-foot>
	</view>
</template>
<script>
	import {
		getXasaGlob
	} from '@/js_sdk/xasaGlobData';

	const db = uniCloud.databaseForJQL();

	export default {
		data() {
			return {
				menu_id:'xasa-behavior',
				xasaGlob: {
					appName: '',
					appAlias: '',
					cloudDownDomain: ''
				},
				//mtitle: '违法行为速查',
				categoryText: '',
				"categories": []
			}
		},

		async onLoad(e) {
			this.menu_id=e.menu_id;
			const that = this;
			//this.getOpenerEventChannel().on('E_HandleMenu', function(data) {
			//	that.mtitle = data.name || that.mtitle
			//})
			let appName = await getXasaGlob('appName');
			let appAlias = await getXasaGlob('appAlias');
			let cloudDownDomain = await getXasaGlob('cloudDownDomain');
			this.xasaGlob = {
				appName: appName,
				appAlias: appAlias,
				cloudDownDomain: cloudDownDomain
			}
			const store=this.$xasaStore;
			store.getCats().then(res => {
				this.categories = res.data
			})
			store.getMenus().then(res=>{
				if(this.menu_id){
					const menu=store.findMenu(this.menu_id);					
					uni.setNavigationBarTitle({
						title: menu.name
					})
				}
			})
		},

		methods: {
			toSearch(e) {
				uni.navigateTo({
					url: './search?menu_id=' + this.menu_id 
				})
			}
		}
	}
</script>

<style>
	/* page {
		background-color: rgb(240, 242, 244);
	} */
</style>

<style lang="scss" scoped>
	.u-cell-icon {
		width: 36rpx;
		height: 36rpx;
		margin-right: 8rpx;
	}

	.m-t-20 {
		margin-top: 0px;
	}
</style>